package com.example.sup.mapStruct;

/**
 * @ClassName Main
 * @Description {TODO}
 * @Author 李哲
 * @Date 22:22 2024/7/31
 * @Version 1.0
 */
public class Main {
    public static void main(String[] args) {
        Person person = new Person();
        person.setFirstName("John");
        person.setLastName("Doe");
        person.setAge(30);

        PersonMapper mapper = PersonMapper.MAPPER; // MapStruct 自动生成静态 MAPPER 实例
        PersonDto personDto = mapper.toDto(person);
        System.out.println("Person DTO: " + personDto);

        Person mappedPerson = mapper.toEntity(personDto);
        System.out.println("Mapped Person: " + mappedPerson);
    }
}
